<html>
    <head>
    	<meta charset="utf-8">
    	<title>变</title>
    	<style type="text/css">
	    	#box{width: 600px;margin: 0 auto;margin-top: 10px;}
            #box div{border:1px solid #f65; margin-top: 20px;}
    	</style>
    </head>
    <body>
    	<div id="box">
    		<div>ssssssssss</div>
            <div>zzzzzzzzzz</div>
            <div>ssssssssss</div>
    	</div>
    </body>
    <script type="text/javascript">
        window.onload=function  () {
            // var obox=document.getElementById('box').getElementsByTagName('div')[0];
            // obox.onclick=function  () {
            //     alert(obox.innerHTML);
            // }
            var obox=document.getElementById('box')
            //var odiv=obox.children;
            var odiv=obox.getElementsByTagName('div');
                for (var i = 0;i< odiv.length; i++) {
                    odiv[i].onclick=function(){
                    alert(this.innerHTML);
                }
            }
        }
    </script>
</html>